# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.
Copyright (C) 2017-2022 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at https://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""
import bkcrypto.contrib.django.fields
import django_mysql.models
from django.db import migrations, models

import apps.node_man.models

# Generated by Django 2.2.8 on 2020-04-10 06:18


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="AccessPoint",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(max_length=255, verbose_name="接入点名称")),
                ("ap_type", models.CharField(default="user", max_length=255, verbose_name="接入点类型")),
                ("region_id", models.CharField(default="", max_length=255, verbose_name="区域id")),
                ("city_id", models.CharField(default="", max_length=255, verbose_name="城市id")),
                ("servers", django_mysql.models.JSONField(default=dict, verbose_name="服务器列表")),
                ("zk_hosts", django_mysql.models.JSONField(default=dict, verbose_name="ZK服务器列表")),
                ("zk_account", models.CharField(default="", max_length=255, verbose_name="ZK账号")),
                (
                    "zk_password",
                    bkcrypto.contrib.django.fields.SymmetricTextField(
                        blank=True, null=True, using="default", verbose_name="密码"
                    ),
                ),
                ("package_inner_url", models.TextField(verbose_name="安装包内网地址")),
                ("package_outer_url", models.TextField(verbose_name="安装包外网地址")),
                ("agent_config", django_mysql.models.JSONField(default=dict, verbose_name="Agent配置信息")),
                ("status", models.CharField(default="", max_length=255, verbose_name="接入点状态")),
                ("description", models.TextField(verbose_name="接入点描述")),
                ("is_enabled", models.BooleanField(default=True, verbose_name="是否启用")),
                ("is_default", models.BooleanField(default=False, verbose_name="是否默认接入点，不可删除")),
            ],
            options={
                "verbose_name": "接入点信息",
                "verbose_name_plural": "接入点信息",
            },
        ),
        migrations.CreateModel(
            name="Cloud",
            fields=[
                ("bk_cloud_id", models.IntegerField(primary_key=True, serialize=False)),
                ("bk_cloud_name", models.CharField(max_length=45)),
                ("isp", models.CharField(blank=True, max_length=45, null=True, verbose_name="云服务商")),
                ("ap_id", models.IntegerField(null=True, verbose_name="接入点ID")),
                ("creator", django_mysql.models.JSONField(default=dict, verbose_name="管控区域创建者")),
                ("is_visible", models.BooleanField(default=True, verbose_name="是否可见")),
                ("is_deleted", models.BooleanField(default=False, verbose_name="是否删除")),
            ],
            options={
                "verbose_name": "管控区域信息",
                "verbose_name_plural": "管控区域信息",
            },
        ),
        migrations.CreateModel(
            name="CmdbEventRecord",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("bk_biz_id", models.IntegerField(db_index=True, verbose_name="订阅ID")),
                ("subscription_id", models.CharField(db_index=True, max_length=50, verbose_name="实例ID")),
                ("event_type", models.CharField(max_length=20, verbose_name="事件类型")),
                ("action", models.CharField(max_length=20, verbose_name="动作")),
                ("obj_type", models.CharField(max_length=32, verbose_name="对象类型")),
                ("data", django_mysql.models.JSONField(default=dict, verbose_name="实例信息")),
                ("create_time", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
            ],
        ),
        migrations.CreateModel(
            name="DownloadRecord",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("category", models.CharField(choices=[("gse_plugin", "gse插件")], max_length=32, verbose_name="下载文件类型")),
                ("query_params", models.CharField(max_length=256, verbose_name="下载查询参数")),
                ("file_path", models.CharField(max_length=256, verbose_name="打包后的文件路径")),
                (
                    "task_status",
                    models.IntegerField(
                        choices=[(0, "任务准备中"), (1, "任务进行中"), (2, "任务已完成"), (3, "任务失败")], default=0, verbose_name="任务状态"
                    ),
                ),
                ("error_message", models.TextField(verbose_name="任务错误信息")),
                ("creator", models.CharField(max_length=64, verbose_name="任务创建者")),
                ("create_time", models.DateTimeField(auto_now_add=True, verbose_name="下载任务创建时间")),
                ("finish_time", models.DateTimeField(auto_now=True, verbose_name="任务完成时间")),
                ("source_app_code", models.CharField(max_length=64, verbose_name="来源系统app code")),
            ],
        ),
        migrations.CreateModel(
            name="GlobalSettings",
            fields=[
                (
                    "key",
                    models.CharField(
                        db_index=True, max_length=255, primary_key=True, serialize=False, verbose_name="键"
                    ),
                ),
                ("v_json", django_mysql.models.JSONField(default=dict, verbose_name="值")),
            ],
            options={
                "verbose_name": "配置表",
                "verbose_name_plural": "配置表",
            },
        ),
        migrations.CreateModel(
            name="GsePluginDesc",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("name", models.CharField(db_index=True, max_length=32, unique=True, verbose_name="插件名")),
                ("description", models.TextField(verbose_name="插件描述")),
                ("scenario", models.TextField(verbose_name="使用场景")),
                ("description_en", models.TextField(blank=True, null=True, verbose_name="英文插件描述")),
                ("scenario_en", models.TextField(blank=True, null=True, verbose_name="英文使用场景")),
                (
                    "category",
                    models.CharField(
                        choices=[("official", "official"), ("external", "external"), ("scripts", "scripts")],
                        max_length=32,
                        verbose_name="所属范围",
                    ),
                ),
                (
                    "launch_node",
                    models.CharField(
                        choices=[("agent", "agent"), ("proxy", "proxy"), ("all", "all")],
                        default="all",
                        max_length=32,
                        verbose_name="宿主节点类型要求",
                    ),
                ),
                ("config_file", models.CharField(blank=True, max_length=128, null=True, verbose_name="配置文件名称")),
                (
                    "config_format",
                    models.CharField(
                        blank=True,
                        choices=[("json", "json"), ("yaml", "yaml"), ("", ""), (None, None)],
                        default="json",
                        max_length=32,
                        null=True,
                        verbose_name="配置文件格式类型",
                    ),
                ),
                ("use_db", models.BooleanField(default=0, verbose_name="是否使用数据库")),
                ("auto_launch", models.BooleanField(default=False, verbose_name="是否在成功安装agent后自动拉起")),
                ("is_binary", models.BooleanField(default=1, verbose_name="是否二进制文件")),
            ],
            options={
                "verbose_name": "插件信息表",
                "verbose_name_plural": "插件信息表",
            },
        ),
        migrations.CreateModel(
            name="Host",
            fields=[
                ("bk_host_id", models.IntegerField(primary_key=True, serialize=False, verbose_name="CMDB主机ID")),
                ("bk_biz_id", models.IntegerField(verbose_name="业务ID")),
                ("bk_cloud_id", models.IntegerField(verbose_name="管控区域ID")),
                ("inner_ip", models.CharField(max_length=45, verbose_name="内网IP")),
                ("outer_ip", models.CharField(blank=True, default="", max_length=45, null=True, verbose_name="外网IP")),
                ("login_ip", models.CharField(blank=True, default="", max_length=45, null=True, verbose_name="登录IP")),
                ("data_ip", models.CharField(blank=True, default="", max_length=45, null=True, verbose_name="数据IP")),
                (
                    "os_type",
                    models.CharField(
                        choices=[("LINUX", "LINUX"), ("WINDOWS", "WINDOWS"), ("AIX", "AIX")],
                        default="linux",
                        max_length=45,
                        verbose_name="操作系统",
                    ),
                ),
                (
                    "node_type",
                    models.CharField(
                        choices=[("AGENT", "AGENT"), ("PROXY", "PROXY"), ("PAGENT", "PAGENT")],
                        max_length=45,
                        verbose_name="节点类型",
                    ),
                ),
                (
                    "node_from",
                    models.CharField(
                        choices=[("CMDB", "CMDB"), ("EXCEL", "EXCEL"), ("INSTALL", "INSTALL")],
                        default="nodeman",
                        max_length=45,
                        verbose_name="节点来源",
                    ),
                ),
                ("ap_id", models.IntegerField(null=True, verbose_name="接入点ID")),
                ("upstream_nodes", django_mysql.models.JSONField(default=list, verbose_name="上游节点")),
                ("created_at", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("updated_at", models.DateTimeField(null=True, verbose_name="更新时间")),
            ],
            options={
                "verbose_name": "主机信息",
                "verbose_name_plural": "主机信息",
                "ordering": ["-updated_at"],
            },
        ),
        migrations.CreateModel(
            name="IdentityData",
            fields=[
                ("bk_host_id", models.IntegerField(primary_key=True, serialize=False, verbose_name="主机ID")),
                (
                    "auth_type",
                    models.CharField(
                        choices=[("PASSWORD", "PASSWORD"), ("KEY", "KEY"), ("TJJ_PASSWORD", "TJJ_PASSWORD")],
                        default="PASSWORD",
                        max_length=45,
                        verbose_name="认证类型",
                    ),
                ),
                ("account", models.CharField(default="", max_length=45, verbose_name="账户名")),
                (
                    "password",
                    bkcrypto.contrib.django.fields.SymmetricTextField(
                        blank=True, null=True, using="default", verbose_name="密码"
                    ),
                ),
                ("port", models.IntegerField(default=22, null=True, verbose_name="端口")),
                (
                    "key",
                    bkcrypto.contrib.django.fields.SymmetricTextField(
                        blank=True, null=True, using="default", verbose_name="密钥"
                    ),
                ),
                (
                    "extra_data",
                    django_mysql.models.JSONField(blank=True, default=dict, null=True, verbose_name="额外认证资料"),
                ),
                ("retention", models.IntegerField(default=1, verbose_name="保留天数")),
                ("updated_at", models.DateTimeField(null=True, verbose_name="更新时间")),
            ],
            options={
                "verbose_name": "主机认证信息",
                "verbose_name_plural": "主机认证信息",
            },
        ),
        migrations.CreateModel(
            name="Job",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_by", models.CharField(default="", max_length=45, verbose_name="操作人")),
                (
                    "job_type",
                    models.CharField(
                        choices=[
                            ("INSTALL_PROXY", "INSTALL_PROXY"),
                            ("INSTALL_AGENT", "INSTALL_AGENT"),
                            ("RESTART_PROXY", "RESTART_PROXY"),
                            ("RESTART_AGENT", "RESTART_AGENT"),
                            ("REINSTALL_PROXY", "REINSTALL_PROXY"),
                            ("REINSTALL_AGENT", "REINSTALL_AGENT"),
                            ("REPLACE_PROXY", "REPLACE_PROXY"),
                            ("UNINSTALL_AGENT", "UNINSTALL_AGENT"),
                            ("REMOVE_AGENT", "REMOVE_AGENT"),
                            ("UNINSTALL_PROXY", "UNINSTALL_PROXY"),
                            ("UPGRADE_PROXY", "UPGRADE_PROXY"),
                            ("UPGRADE_AGENT", "UPGRADE_AGENT"),
                            ("IMPORT_PROXY", "IMPORT_PROXY"),
                            ("IMPORT_AGENT", "IMPORT_AGENT"),
                            ("RESTART_AGENT", "RESTART_AGENT"),
                            ("RESTART_PROXY", "RESTART_PROXY"),
                            ("MAIN_START_PLUGIN", "MAIN_START_PLUGIN"),
                            ("MAIN_STOP_PLUGIN", "MAIN_STOP_PLUGIN"),
                            ("MAIN_RESTART_PLUGIN", "MAIN_RESTART_PLUGIN"),
                            ("MAIN_RELOAD_PLUGIN", "MAIN_RELOAD_PLUGIN"),
                            ("MAIN_DELEGATE_PLUGIN", "MAIN_DELEGATE_PLUGIN"),
                            ("MAIN_UNDELEGATE_PLUGIN", "MAIN_UNDELEGATE_PLUGIN"),
                            ("MAIN_INSTALL_PLUGIN", "MAIN_INSTALL_PLUGIN"),
                            ("UPDATE_AUTHINFO", "UPDATE_AUTHINFO"),
                            ("PACKING_PLUGIN", "PACKING_PLUGIN"),
                        ],
                        default="INSTALL_PROXY",
                        max_length=45,
                        verbose_name="作业类型",
                    ),
                ),
                ("subscription_id", models.IntegerField(db_index=True, verbose_name="订阅ID")),
                ("task_id_list", django_mysql.models.JSONField(default=list, verbose_name="任务ID列表")),
                ("start_time", models.DateTimeField(auto_now_add=True, verbose_name="创建任务时间")),
                ("end_time", models.DateTimeField(blank=True, null=True, verbose_name="任务结束时间")),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("PENDING", "等待执行"),
                            ("RUNNING", "正在执行"),
                            ("SUCCESS", "执行成功"),
                            ("FAILED", "执行失败"),
                            ("PART_FAILED", "部分失败"),
                            ("TERMINATED", "已终止"),
                        ],
                        default="RUNNING",
                        max_length=45,
                        verbose_name="任务状态",
                    ),
                ),
                (
                    "global_params",
                    django_mysql.models.JSONField(blank=True, default=dict, null=True, verbose_name="全局运行参数"),
                ),
                (
                    "statistics",
                    django_mysql.models.JSONField(blank=True, default=dict, null=True, verbose_name="任务统计信息"),
                ),
                ("bk_biz_scope", django_mysql.models.JSONField(default=dict, verbose_name="业务范围")),
                ("error_hosts", django_mysql.models.JSONField(default=dict, verbose_name="发生错误的主机")),
            ],
            options={
                "verbose_name": "任务信息",
                "verbose_name_plural": "任务信息",
                "ordering": ["-id"],
            },
        ),
        migrations.CreateModel(
            name="JobTask",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("job_id", models.IntegerField(verbose_name="作业ID")),
                ("bk_host_id", models.IntegerField(verbose_name="主机ID")),
                ("instance_id", models.CharField(max_length=45, verbose_name="实例ID")),
                ("pipeline_id", models.CharField(blank=True, default="", max_length=50, verbose_name="Pipeline节点ID")),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("QUEUE", "QUEUE"),
                            ("RUNNING", "RUNNING"),
                            ("SUCCESS", "SUCCESS"),
                            ("FAILED", "FAILED"),
                        ],
                        default="QUEUE",
                        max_length=45,
                    ),
                ),
                ("current_step", models.CharField(default="", max_length=45, verbose_name="当前步骤")),
                ("create_time", models.DateTimeField(auto_now_add=True)),
                ("update_time", models.DateTimeField(auto_now=True)),
                ("end_time", models.DateTimeField(blank=True, null=True)),
            ],
            options={
                "verbose_name": "任务详情",
                "verbose_name_plural": "任务详情",
            },
        ),
        migrations.CreateModel(
            name="Packages",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("pkg_name", models.CharField(max_length=128, verbose_name="压缩包名")),
                ("version", models.CharField(max_length=128, verbose_name="版本号")),
                ("module", models.CharField(max_length=32, verbose_name="所属服务")),
                ("project", models.CharField(db_index=True, max_length=32, verbose_name="工程名")),
                ("pkg_size", models.IntegerField(verbose_name="包大小")),
                ("pkg_path", models.CharField(max_length=128, verbose_name="包路径")),
                ("md5", models.CharField(max_length=32, verbose_name="md5值")),
                ("pkg_mtime", models.CharField(max_length=48, verbose_name="包更新时间")),
                ("pkg_ctime", models.CharField(max_length=48, verbose_name="包创建时间")),
                ("location", models.CharField(max_length=512, verbose_name="安装包链接")),
                (
                    "os",
                    models.CharField(
                        choices=[("windows", "windows"), ("linux", "linux"), ("aix", "aix")],
                        db_index=True,
                        default="linux",
                        max_length=32,
                        verbose_name="系统类型",
                    ),
                ),
                (
                    "cpu_arch",
                    models.CharField(
                        choices=[("x86", "x86"), ("x86_64", "x86_64"), ("powerpc", "powerpc")],
                        db_index=True,
                        default="x86_64",
                        max_length=32,
                        verbose_name="CPU类型",
                    ),
                ),
                ("is_release_version", models.BooleanField(db_index=True, default=True, verbose_name="是否已经发布版本")),
                ("is_ready", models.BooleanField(default=True, verbose_name="插件是否可用")),
            ],
            options={
                "verbose_name": "模块/工程安装包信息表",
                "verbose_name_plural": "模块/工程安装包信息表",
            },
        ),
        migrations.CreateModel(
            name="PipelineTree",
            fields=[
                ("id", models.CharField(max_length=32, primary_key=True, serialize=False, verbose_name="PipelineID")),
                ("tree", django_mysql.models.JSONField(default=dict, verbose_name="Pipeline拓扑树")),
            ],
        ),
        migrations.CreateModel(
            name="PluginConfigInstance",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("plugin_config_template", models.IntegerField(db_index=True, verbose_name="对应实例记录ID")),
                ("render_data", models.TextField(verbose_name="渲染参数")),
                ("data_md5", models.CharField(default="", max_length=50, verbose_name="渲染参数MD5")),
                ("creator", models.CharField(max_length=64, verbose_name="创建者")),
                ("create_time", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("source_app_code", models.CharField(max_length=64, verbose_name="来源系统app code")),
            ],
            options={
                "verbose_name": "插件配置文件实例",
                "verbose_name_plural": "插件配置文件实例表",
            },
        ),
        migrations.CreateModel(
            name="ProcControl",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("module", models.CharField(max_length=32, verbose_name="模块名")),
                ("project", models.CharField(max_length=32, verbose_name="工程名")),
                ("plugin_package_id", models.IntegerField(default=0, verbose_name="记录对应的插件包ID")),
                ("install_path", models.TextField(verbose_name="安装路径")),
                ("log_path", models.TextField(verbose_name="日志路径")),
                ("data_path", models.TextField(verbose_name="数据文件路径")),
                ("pid_path", models.TextField(verbose_name="pid文件路径")),
                ("start_cmd", models.TextField(blank=True, default="", verbose_name="启动命令")),
                ("stop_cmd", models.TextField(blank=True, default="", verbose_name="停止命令")),
                ("restart_cmd", models.TextField(blank=True, default="", verbose_name="重启命令")),
                ("reload_cmd", models.TextField(blank=True, default="", verbose_name="重载命令")),
                ("kill_cmd", models.TextField(blank=True, default="", verbose_name="kill命令")),
                ("version_cmd", models.TextField(blank=True, default="", verbose_name="进程版本查询命令")),
                ("health_cmd", models.TextField(blank=True, default="", verbose_name="进程健康检查命令")),
                ("debug_cmd", models.TextField(blank=True, default="", verbose_name="调试进程命令")),
                (
                    "os",
                    models.CharField(
                        choices=[("windows", "windows"), ("linux", "linux"), ("aix", "aix")],
                        default="linux",
                        max_length=32,
                        verbose_name="系统类型",
                    ),
                ),
                ("process_name", models.CharField(default=None, max_length=128, null=True, verbose_name="实际二进制执行文件名")),
                (
                    "port_range",
                    models.TextField(blank=True, default="", null=True, verbose_name="插件允许使用的端口范围，格式 1,3,6-8,10-100"),
                ),
                ("need_delegate", models.BooleanField(default=True, verbose_name="是否需要托管")),
            ],
            options={
                "verbose_name": "模块/进程控制信息表",
                "verbose_name_plural": "模块/进程控制信息表",
            },
        ),
        migrations.CreateModel(
            name="ProcessStatus",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("bk_host_id", models.IntegerField(db_index=True, verbose_name="主机ID")),
                ("name", models.CharField(db_index=True, default="gseagent", max_length=45, verbose_name="进程名称")),
                (
                    "status",
                    models.CharField(
                        choices=[("RUNNING", "RUNNING"), ("UNKNOWN", "UNKNOWN"), ("TERMINATED", "TERMINATED")],
                        db_index=True,
                        default="UNKNOWN",
                        max_length=45,
                        verbose_name="进程状态",
                    ),
                ),
                (
                    "is_auto",
                    models.CharField(
                        choices=[("AUTO", "AUTO"), ("UNAUTO", "UNAUTO")],
                        default="AUTO",
                        max_length=45,
                        verbose_name="是否自动启动",
                    ),
                ),
                ("version", models.CharField(blank=True, default="", max_length=45, null=True, verbose_name="进程版本")),
                (
                    "proc_type",
                    models.CharField(
                        choices=[("AGENT", "AGENT"), ("PLUGIN", "PLUGIN")],
                        default="AGENT",
                        max_length=45,
                        verbose_name="进程类型",
                    ),
                ),
                ("configs", django_mysql.models.JSONField(default=list, verbose_name="配置文件")),
                ("listen_ip", models.CharField(max_length=45, null=True, verbose_name="监听IP")),
                ("listen_port", models.IntegerField(null=True, verbose_name="监听端口")),
                ("setup_path", models.TextField(default="", verbose_name="二进制文件所在路径")),
                ("log_path", models.TextField(default="", verbose_name="日志路径")),
                ("data_path", models.TextField(default="", verbose_name="数据文件路径")),
                ("pid_path", models.TextField(default="", verbose_name="pid文件路径")),
                ("group_id", models.CharField(db_index=True, default="", max_length=50, verbose_name="插件组ID")),
                (
                    "source_type",
                    models.CharField(
                        choices=[("default", "默认"), ("subscription", "订阅"), ("debug", "调试")],
                        default="default",
                        max_length=128,
                        verbose_name="来源类型",
                    ),
                ),
                ("source_id", models.CharField(default=None, max_length=128, null=True, verbose_name="来源ID")),
            ],
            options={
                "verbose_name": "主机进程状态",
                "verbose_name_plural": "主机进程状态",
            },
        ),
        migrations.CreateModel(
            name="Profile",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("bk_username", models.CharField(max_length=45, verbose_name="用户名")),
                ("favorite", django_mysql.models.JSONField(default=dict, verbose_name="用户收藏信息,比如管控区域等")),
                ("update_time", models.DateTimeField(auto_now_add=True)),
            ],
            options={
                "verbose_name": "个人资料",
                "verbose_name_plural": "个人资料",
            },
        ),
        migrations.CreateModel(
            name="Subscription",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("bk_biz_id", models.IntegerField(db_index=True, null=True, verbose_name="业务ID")),
                (
                    "object_type",
                    models.CharField(choices=[("HOST", "主机"), ("SERVICE", "服务")], max_length=20, verbose_name="对象类型"),
                ),
                (
                    "node_type",
                    models.CharField(
                        choices=[("TOPO", "拓扑"), ("INSTANCE", "实例"), ("INSTANCE", "实例")],
                        max_length=20,
                        verbose_name="节点类型",
                    ),
                ),
                ("nodes", django_mysql.models.JSONField(default=list, verbose_name="节点")),
                ("target_hosts", django_mysql.models.JSONField(default=None, null=True, verbose_name="下发的目标机器")),
                ("from_system", models.CharField(max_length=30, verbose_name="所属系统")),
                ("update_time", models.DateTimeField(auto_now=True, verbose_name="更新时间")),
                ("create_time", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("creator", models.CharField(max_length=64, verbose_name="操作人")),
                ("enable", models.BooleanField(db_index=True, default=True)),
                ("is_deleted", models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name="SubscriptionInstanceRecord",
            fields=[
                ("id", models.BigAutoField(primary_key=True, serialize=False)),
                ("task_id", models.IntegerField(db_index=True, verbose_name="任务ID")),
                ("subscription_id", models.IntegerField(db_index=True, verbose_name="订阅ID")),
                ("instance_id", models.CharField(db_index=True, max_length=50, verbose_name="实例ID")),
                ("instance_info", django_mysql.models.JSONField(default=dict, verbose_name="实例信息")),
                ("steps", django_mysql.models.JSONField(default=dict, verbose_name="步骤信息")),
                ("pipeline_id", models.CharField(blank=True, default="", max_length=50, verbose_name="Pipeline ID")),
                ("update_time", models.DateTimeField(auto_now=True, verbose_name="更新时间")),
                ("create_time", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("need_clean", models.BooleanField(default=False, verbose_name="是否需要清洗临时信息")),
                ("is_latest", models.BooleanField(default=True, verbose_name="是否为实例最新记录")),
            ],
        ),
        migrations.CreateModel(
            name="SubscriptionTask",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("subscription_id", models.IntegerField(db_index=True, verbose_name="订阅ID")),
                ("scope", django_mysql.models.JSONField(default=dict, verbose_name="执行范围")),
                ("actions", django_mysql.models.JSONField(default=dict, verbose_name="不同step执行的动作名称。键值对")),
                ("create_time", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("is_auto_trigger", models.BooleanField(default=False, verbose_name="是否为自动触发")),
            ],
            options={
                "ordering": ["-create_time"],
            },
        ),
        migrations.CreateModel(
            name="UploadPackage",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("file_name", models.CharField(db_index=True, max_length=64, verbose_name="上传包文件名")),
                ("module", models.CharField(max_length=32, verbose_name="模块名")),
                ("file_path", models.CharField(max_length=128, verbose_name="文件上传的路径名")),
                ("file_size", models.IntegerField(verbose_name="文件大小，单位Byte")),
                ("md5", models.CharField(max_length=32, verbose_name="文件MD5")),
                ("upload_time", models.DateTimeField(auto_now_add=True, verbose_name="文件上传时间")),
                ("creator", models.CharField(max_length=64, verbose_name="上传用户名")),
                ("source_app_code", models.CharField(max_length=64, verbose_name="来源系统app code")),
            ],
            options={
                "verbose_name": "文件包上传记录",
                "verbose_name_plural": "文件包上传记录表",
            },
        ),
        migrations.CreateModel(
            name="SubscriptionStep",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("subscription_id", models.IntegerField(db_index=True, verbose_name="订阅ID")),
                ("index", models.IntegerField(default=0, verbose_name="顺序")),
                ("step_id", models.CharField(max_length=64, verbose_name="步骤ID")),
                ("type", models.CharField(max_length=20, verbose_name="步骤类型")),
                ("config", django_mysql.models.JSONField(default=dict, verbose_name="配置")),
                ("params", django_mysql.models.JSONField(default=dict, verbose_name="参数")),
            ],
            options={
                "ordering": ["index"],
                "unique_together": {("subscription_id", "index"), ("subscription_id", "step_id")},
            },
        ),
        migrations.CreateModel(
            name="PluginConfigTemplate",
            fields=[
                ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("plugin_name", models.CharField(db_index=True, max_length=32, verbose_name="插件名")),
                ("plugin_version", models.CharField(max_length=128, verbose_name="版本号")),
                ("name", models.CharField(max_length=128, verbose_name="配置模板名")),
                ("version", models.CharField(max_length=128, verbose_name="配置模板版本")),
                ("format", models.CharField(max_length=16, verbose_name="文件格式")),
                ("file_path", models.CharField(max_length=128, verbose_name="文件在该插件目录中相对路径")),
                ("content", models.TextField(verbose_name="配置内容")),
                ("is_release_version", models.BooleanField(verbose_name="是否已经发布版本")),
                ("creator", models.CharField(max_length=64, verbose_name="创建者")),
                ("create_time", models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("source_app_code", models.CharField(max_length=64, verbose_name="来源系统app code")),
            ],
            options={
                "verbose_name": "插件配置文件模板",
                "verbose_name_plural": "插件配置文件模板表",
                "unique_together": {("plugin_name", "plugin_version", "name", "version")},
            },
        ),
    ]
